import Vue from 'vue'
import App from './App.vue'

/* 引入组件 */
import router from '@/common/router'
import vuexStore from '@/common/storage/vuex';
import ElementUI from 'element-ui';
import * as echarts from "echarts";

/* 引入基础设施 */
import utils from "@/common/infrastructure/utils";
import exetendInit from "@/common/infrastructure/exetend";
import dataMediator from "@/common/data/data_mediator";
import enumMediator from "@/common/enum/enum_mediator";
import storageMediator from "@/common/storage/storage_mediator";
import apiMediator from "@/common/api/api_mediator";
import elementUiExetend from "@/common/element_ui_exetend/element_ui_exetend";
import serviceMediator from "@/common/service/service_mediator";

/* 引入样式*/
import 'element-ui/lib/theme-chalk/index.css';

/* 主方法 */
// eslint-disable-next-line no-unused-vars
let main = async function () {

    Vue.config.productionTip = false;

    // 注册 Element组件
    Vue.use(ElementUI);

    // 初始化 扩展
    exetendInit();

    // 初始化 字体大小
    utils.computeFontSize();

    // 注册 Element组件
    Vue.use(ElementUI);

    // 注入 全局变量
    Vue.prototype.$globalData = dataMediator;

    // 初始化 字体大小
    utils.computeFontSize();

    // 注入 全局变量
    Vue.prototype.$globalData = dataMediator;
    Vue.prototype.$globalData.appSettings = await utils.getLocalResource(`appSettings.json`);

    // 注入 工具
    Vue.prototype.$utils = utils;

    // 注入 枚举
    Vue.prototype.$enum = enumMediator;

    // 注入 仓储
    Vue.prototype.$storage = storageMediator;

    // 注入 接口
    Vue.prototype.$api = apiMediator(Vue.prototype);

    // 注入 服务
    Vue.prototype.$service = serviceMediator(Vue.prototype);

    // 注入 UI扩展
    Vue.prototype.$uiExetend = elementUiExetend;

    // 注入 echarts
    Vue.prototype.$echarts = echarts;

    new Vue({
        router,
        store: vuexStore,
        render: h => h(App),
    }).$mount('#app')

}();
